package com.centling.smartSealForPhone.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import com.centling.smartSealForPhone.R;
import com.centling.smartSealForPhone.utils.ShowToast;
import com.centling.smartSealForPhone.widget.galleryview.GlideLoader;
import com.centling.smartSealForPhone.widget.galleryview.MediaInfo;
import com.centling.smartSealForPhone.widget.galleryview.ScrollGalleryView;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Jessie on 2016/8/17.
 */
public class AuditorPicCheckActivity extends TitleBarActivity implements View.OnClickListener{

    private ScrollGalleryView scrollGalleryView;
    private List<MediaInfo> infos;
    private String[] urls;
    private ImageView back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_auditor_check_pic);
        setTitleBarVisibility(View.GONE);
        back=(ImageView) findViewById(R.id.iv_pic_album_finish);
        scrollGalleryView=(ScrollGalleryView)findViewById(R.id.sgv_auditor_pic_check);
        scrollGalleryView.setFragmentManager(getSupportFragmentManager());
        initData();
        back.setOnClickListener(this);
    }

   private void initData()
    {
        infos=new ArrayList<>();
        if(getIntent().hasExtra("picList")) {
            urls=getIntent().getStringArrayExtra("picList");
            for(int i=0;i<urls.length;i++){
            infos.add(MediaInfo.mediaLoader(new GlideLoader(urls[i])));
            }
            scrollGalleryView.addMedia(infos);
        }
        else {
            ShowToast.shortTime("无法查看图片");
        }
    }


    @Override
    public void onClick(View v) {
        switch(v.getId())
        {
            case R.id.iv_pic_album_finish:
                finish();
        }
    }
}
